#include "process.h"

char style[S_NUM] = {'-', '.', '#', '>', '+'};

void Processon()//函数的定义
{
    int cnt = 0;
    char bar[NUM];
    memset(bar, '\0', sizeof(bar));

    const char *lable = "|\\-/";

    while(cnt <= 100)
    {
        printf("\033[42;34m[%-100s][%d%%][%c]\033[0m\r", bar, cnt, lable[cnt%4]);
        fflush(stdout);//刷新缓冲区
        bar[cnt++] = style[N];
        usleep(50000);//微秒,5秒跑完,一次休眠0.05秒 = 0.05 * 100 0000 = 50000微秒
    }

    printf("\n");
}